var status = -1;
var selectionLog = [];

function action(e, c, b) {
    if (status == 0 && e == 0) {
        cm.dispose();
        return
    }
    status++;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            if (cm.getMapId() == 450011420 || cm.getMapId() == 450011410) {
                cm.setPartner(1, 3003759, 80002577, 0);
                cm.setPartner(1, 3003760, 80002579, 0);
                cm.fieldEffect_PlayFieldSound("Sound/FarmSE.img/boxResult", 100)
            } else {
                if (cm.getMapId() == 450011530) {
                    if (cm.isQuestActive(35717)) {
                        cm.addPopupSay(0, 1500, "果然倒胃口……", "", 0);
                        cm.addPopupSay(0, 1500, "黑漆漆的完全看不出外形……但黑影……", "", 0);
                        cm.addPopupSay(0, 1500, "不。还是先去找其他人吧。那些一定是提示。", "", 0)
                    } else {
                        cm.dispose()
                    }
                } else {
                    if (cm.getMapId() == 450012100) {
                        if (cm.isQuestFinished(35802) && (!cm.isQuestActive(35803) && !cm.isQuestFinished(35803))) {
                            cm.updateInfoQuest(35831, "52=h1;53=h1;55=h0")
                        } else {
                            cm.dispose()
                        }
                    } else {
                        if (cm.getMapId() == 450012110) {
                            if (cm.isQuestFinished(35803) && (!cm.isQuestActive(35804) && !cm.isQuestFinished(35804))) {
                                cm.updateInfoQuest(35831, "52=h1;53=h1;55=h1;56=h0")
                            } else {
                                cm.dispose()
                            }
                        } else {
                            if (cm.isQuestActive(34474)) {
                                var d = cm.getNumberFromQuestInfo(34474, "fin");
                                if (d >= 1) {
                                    cm.setPartner(1, 34480, 80002269, 0)
                                }
                                if (d >= 2) {
                                    cm.setPartner(1, 34481, 80002269, 0)
                                }
                                if (d >= 3) {
                                    cm.setPartner(1, 34482, 80002269, 0)
                                }
                                if (d >= 4) {
                                    cm.setPartner(1, 34483, 80002269, 0)
                                }
                                if (d >= 5) {
                                    cm.setPartner(1, 34484, 80002269, 0)
                                }
                                if (d >= 6) {
                                    cm.setPartner(1, 34485, 80002269, 0)
                                }
                                if (d >= 7) {
                                    cm.setPartner(1, 34486, 80002269, 0)
                                }
                            } else {
                                if (cm.isQuestFinished(37711) && cm.getQuestStatus(37712) == 0) {
                                    cm.setPartner(true, 3004730, 80002907, 0);
                                    cm.setPartner(true, 3004731, 80002908, 0)
                                } else {
                                    if (cm.isQuestFinished(37712) && !cm.isQuestFinished(37713)) {
                                        cm.setPartner(true, 3004730, 80002907, 0);
                                        cm.setPartner(true, 3004731, 80002908, 0)
                                    } else {
                                        if (cm.isQuestFinished(37714) && !cm.isQuestFinished(37715)) {
                                            cm.setPartner(true, 3004730, 80002907, 0);
                                            cm.setPartner(true, 3004731, 80002908, 0)
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            cm.dispose();
            if (cm.getMapId() < 450002000) {
                cm.spawnSpecialMobRepeat(8641016, 3 * 60 * 1000)
            } else {
                if (cm.getMapId() < 450003000) {
                    cm.spawnSpecialMobRepeat(8642023, 3 * 60 * 1000)
                } else {
                    if (cm.getMapId() < 450005000) {
                        cm.spawnSpecialMobRepeat(8643017, 3 * 60 * 1000)
                    } else {
                        if (cm.getMapId() < 450006000) {
                            cm.spawnSpecialMobRepeat(8644012, 3 * 60 * 1000)
                        } else {
                            if (cm.getMapId() < 450006100) {
                                cm.spawnSpecialMobRepeat(8644413, 3 * 60 * 1000)
                            } else {
                                if (cm.getMapId() < 450006200) {
                                    cm.spawnSpecialMobRepeat(8644415, 3 * 60 * 1000)
                                } else {
                                    if (cm.getMapId() < 450007000) {
                                        cm.spawnSpecialMobRepeat(8644417, 3 * 60 * 1000)
                                    } else {
                                        if (cm.getMapId() < 450007100) {
                                            cm.spawnSpecialMobRepeat(8644520, 3 * 60 * 1000)
                                        } else {
                                            if (cm.getMapId() < 450007200) {
                                                cm.spawnSpecialMobRepeat(8644522, 3 * 60 * 1000)
                                            } else {
                                                if (cm.getMapId() < 450009000) {
                                                    cm.spawnSpecialMobRepeat(8644524, 3 * 60 * 1000)
                                                } else {
                                                    if (cm.getMapId() < 450010000) {
                                                        cm.spawnSpecialMobRepeat(8644680, 3 * 60 * 1000)
                                                    } else {
                                                        if (cm.getMapId() < 450011500) {
                                                            cm.spawnSpecialMobRepeat(8644713, 3 * 60 * 1000)
                                                        } else {
                                                            if (cm.getMapId() < 450011600) {
                                                                cm.spawnSpecialMobRepeat(8644715, 3 * 60 * 1000)
                                                            } else {
                                                                if (cm.getMapId() < 450012000) {
                                                                    cm.spawnSpecialMobRepeat(8644717, 3 * 60 * 1000)
                                                                } else {
                                                                    if (cm.getMapId() < 450012200) {
                                                                        cm.spawnSpecialMobRepeat(8645024, 3 * 60 * 1000)
                                                                    } else {
                                                                        if (cm.getMapId() < 450014000) {
                                                                            cm.spawnSpecialMobRepeat(8645026, 3 * 60 * 1000)
                                                                        } else {
                                                                            if (cm.getMapId() < 450015000) {
                                                                                cm.spawnSpecialMobRepeat(8641064, 3 * 60 * 1000)
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

function start() {
    status = -1;
    action(1, 0, 0)
};